<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="jquery/jquery-1.8.2.js"></script>
<script type="text/javascript">
		function del(contractNo) {
			if(confirm("确定要删除吗")){
				$.post(
						"delete",
						{contractNo:contractNo},
						function (obj) {
							if(obj>0){
							alert("删除成功");
							location.reload();
							}else{
								alert("删除失败");
							}
						}
					);
			}
		}
</script>
<body>
	<form action="list" method="post">
		合同日期<input type="date" name="minDate" value="${dantou.minDate }">
		  	  <input type="date" name="maxDate" value="${dantou.maxDate }">
		合同编号<input type="text" name="contractNo" value="${dantou.contractNo }"><br>
		总值<input type="text" name="mintotalValue" value="${dantou.mintotalValue }">
		   <input type="text" name="maxtotalValue" value="${dantou.maxtotalValue }">
		卖方<input type="text" name="seller" value="${dantou.seller }">
		买方<input type="text" name="buyer" value="${dantou.buyer }">
		附件<input type="text" name="appendx" value="${dantou.appendx }">
		备注<input type="text" name="remarks" value="${dantou.remarks }">
		<input type="submit" value="查询">
		<a href="toAdd">新增</a>
			<table>
				<tr>
					<td>编号</td>
					<td>日期</td>
					<td>买方</td>
					<td>卖方</td>
					<td>总值</td>
					<td>附件</td>
					<td>备注</td>
					<td>
					操作
					</td>
				</tr>
					<c:forEach items="${list }" var="s">
						<tr>
					<td>${dantou.contractNo }</td>
					<td>
						<fmt:formatDate value="${dantou.contractDate }"/>
					</td>
					<td>${dantou.buyer }</td>
					<td>${dantou.seller }</td>
					<td>${dantou.totalValue }</td>
					<td>${dantou.appendx }</td>
					<td>${dantou.remarks }</td>
					<td>
					<a href="toUpdate?contractNo=${dantou.contractNo }">修改</a>
					<input type="button" value="删除" onclick="del(${dantou.contractNo })">
					</td>
				</tr>
					</c:forEach>
			</table>
		<jsp:include page="jquery/page.jsp"></jsp:include>
	</form>
</body>
</html>